package cn.iocoder.yudao.module.peizhen.dal.mysql.staff;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.peizhen.controller.app.staff.vo.AppStaffPageReqVO;
import cn.iocoder.yudao.module.peizhen.dal.dataobject.staff.StaffDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.peizhen.controller.admin.staff.vo.*;

/**
 * 陪诊师、护工 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface StaffMapper extends BaseMapperX<StaffDO> {

    default PageResult<StaffDO> selectPage(StaffPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<StaffDO>()
                .likeIfPresent(StaffDO::getName, reqVO.getName())
                .eqIfPresent(StaffDO::getSex, reqVO.getSex())
                .eqIfPresent(StaffDO::getJob, reqVO.getJob())
                .eqIfPresent(StaffDO::getAccount, reqVO.getAccount())
                .likeIfPresent(StaffDO::getProvince, reqVO.getProvince())
                .likeIfPresent(StaffDO::getCity, reqVO.getCity())
                .eqIfPresent(StaffDO::getPayAccount, reqVO.getPayAccount())
                .eqIfPresent(StaffDO::getPhone, reqVO.getPhone())
                .orderByDesc(StaffDO::getId));
    }


    default PageResult<StaffDO> selectPage(AppStaffPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<StaffDO>()
                .likeIfPresent(StaffDO::getName, reqVO.getName())
                .eqIfPresent(StaffDO::getCityCode, reqVO.getCityCode())
                .eqIfPresent(StaffDO::getSex, reqVO.getSex())
                .eqIfPresent(StaffDO::getJob, reqVO.getJob())
                .eqIfPresent(StaffDO::getAccount, reqVO.getAccount())
                .eqIfPresent(StaffDO::getProvince, reqVO.getProvince())
                .eqIfPresent(StaffDO::getCity, reqVO.getCity())
                .eqIfPresent(StaffDO::getPayAccount, reqVO.getPayAccount())
                .eqIfPresent(StaffDO::getPhone, reqVO.getPhone())
                .orderByDesc(StaffDO::getId));
    }

}